# import requests
# from bs4 import BeautifulSoup
# #获取页面
# url='http://www.shanghairanking.cn/rankings/bcur/2020'
# reponse=requests.get(url=url)
# reponse.encoding='utf-8'
# #BeautifulSoup实例化
# soup=BeautifulSoup(reponse.text,'html.parser')
# #标签的定位
# list=soup.select('table>tbody>tr')
# #取数
# for i in list:
#     array=i('td')
#     print(array[0].text,array[1].text,array[2].text,array[4].text)
#
#
#
from aip import AipSpeech

""" 你的 APPID AK SK """
APP_ID = '22802782'
API_KEY = 'Q3Gd8iddrcp6HXQEoXpdOQkQ'
SECRET_KEY = 'cRfn3jGyQFH7XI8nOdGBsLao5pvpKhfY'

client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
result  = client.synthesis('宝贝我爱你么么哒么么哒么么哒么么哒', 'zh', 0, {
    'vol': 5,
})

# 识别正确返回语音二进制 错误则返回dict 参照下面错误码
if not isinstance(result, dict):
    with open('audio.mp3', 'wb') as f:
        f.write(result)
else:
    print(result)